{extend name="base"/}
{block name="title"}
登录
{/block}
{block name="css"}
<link rel="stylesheet" href="__MOBILE__/css/login.css"/>
<style>
    html,body,.bgbox{
        width: 100%;
        height: 100%;
    }
</style>

{/block}
{block name="content"}
    <div class="bgbox">
        <div class="logoImg"><img src="__MOBILE__/images/logo.png" alt=""></div>
        <ul>
            <li>
                    <img src="__MOBILE__/images/zhanghaoimg.png" alt="">
                    <input type="text" placeholder="请输入账号" class="account">
            </li>
            <li>
                    <img src="__MOBILE__/images/mimaimg.png" alt="">
                    <input type="password" placeholder="请输入密码" class="password">
            </li>
        </ul>
        <div class="loginbtn">登录</div>
        <div class="forgetpass"><a href="{:url('/langjinmobile/registered/forgetpass')}">忘记密码?</a></div>
        <div class="reglogin"><a href="{:url('/langjinmobile/registered/registered')}">注册登录</a></div>
    </div>
{/block}
{block name="js"}
<script>
    var hei = window.screen.height
    // $('.bgbox').css({'height':hei + 'px'})
    $('.loginbtn').click(function(){

        var mobile = $('.account').val();
        var pwd = $('.password').val();
        var myreg = /^[1][3,4,5,7,8][0-9]{9}$/;
        if (mobile == '' || !myreg.test(mobile)) {
            msg_alert("请输入正确的手机号");
        } else if (pwd == '') {
            msg_alert("请输入密码");
        } else {
            $.post("{:url('/langjinmobile/registered/dologin')}", {
                mobile: mobile,
                pwd: pwd
            }, function (data) {
                var obj = eval('(' + data + ')');
                console.log(obj);
                if (obj[0]['type'] == 1) {
                    msg_alert('登录成功');
                    window.location.href = "/langjinmobile/home";
                    //msg_alert_url('{:lang("登录成功")}', "{:url('/langjinmobile/index')}");

                } else if (obj[0]['type'] == 2) {
                    msg_alert_url('{:lang("用户不存在")}');
                } else if (obj[0]['type'] == 4) {
                    msg_alert_url('{:lang("用户被锁定")}');
                } else {
                    var phone = obj[0]['msg'];
                    msg_alert_url('{:lang("密码错误")}');
                }
            })

        }
    })
</script>
{/block}